package com.evanram.code.java.chatclient; import java.io.IOException; public class PrintInputStream implements Runnable { @Override public void run() { while(true) { try { String inStr = Client.getNextInput(); if(inStr == null) //disconnect if connection's dead { Message.logError("Connection lost with server."); System.exit(1); } System.out.println(inStr); Client.flushOutput(); } catch(IOException e) { Message.logError("Encountered IOException when reading input next line."); System.exit(-1); } } } }